import 'package:flutter/material.dart';

// 水平滚动容器
class HorizontalScrollCardWrap extends StatelessWidget {
  final Widget? leading;
  final Widget? trailing;
  final Widget? body;
  final int leadingFlex;
  final int trailingFlex;

  const HorizontalScrollCardWrap({
    super.key,
    this.leading,
    this.trailing,
    this.leadingFlex = 0,
    this.trailingFlex = 0,
    this.body,
  });
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      decoration: const BoxDecoration(color: Colors.white),
      child: Column(
        children: [
          Container(
            padding: const EdgeInsets.all(10),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Expanded(
                  flex: leadingFlex,
                  child: leading ?? const SizedBox(),
                ),
                Expanded(
                  flex: trailingFlex,
                  child: trailing ?? const SizedBox(),
                )
              ],
            ),
          ),
          body ?? const SizedBox(),
          const SizedBox(height: 10)
        ],
      ),
    );
  }
}
